<?php session_start();
$forum = $_GET['forum'];
$assunto = $_GET['assunto'];
$topico = $_GET['topico'];

if($_SESSION['login'] == "") {
    echo "<meta HTTP-EQUIV='Refresh' CONTENT='0;URL=/Esquina_da_TI/GUI/EfetuarLogin.php'>";
}
?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <link href="/Esquina_da_TI/default.css" rel="stylesheet" type="text/css" media="screen" />
        <script src="/Esquina_da_TI/js/jquery-1.3.2.js" type="text/javascript"></script>
        <script src="/Esquina_da_TI/js/exibirPaginas.js" type="text/javascript"></script>
        <script src="/Esquina_da_TI/js/tituloDinamico.js" type="text/javascript"></script>
        <title><?php echo $topico;?></title>

        <script type="text/javascript">
            function emoticon(icone){
                mensagem = document.getElementById('message');
                mensagem.value = mensagem.value + icone;                
            }


            function fontSize(tamanho){
                mensagem = document.getElementById('message');
                mensagem.value = mensagem.value + tamanho;
            }

            function fontColor(cor){
                mensagem = document.getElementById('message');
                mensagem.value = mensagem.value + cor;
            }

            function colocarNegrito(campo){
                valor = campo.value;
                mensagem = document.getElementById('message');                
                if(valor == 'B'){
                    campo.value = valor + '*';
                    mensagem.value = mensagem.value + '<b>';
                    campo.focus();
                }else if(valor == 'B*'){
                    campo.value = 'B';
                    mensagem.value = mensagem.value + '</b>';
                    campo.focus();
                }                
            }

            function colocarItalico(campo){
                valor = campo.value;
                mensagem = document.getElementById('message');
                if(valor == 'i'){
                    campo.value = valor + '*';
                    mensagem.value = mensagem.value + '<i>';
                }else if(valor == 'i*'){
                    campo.value = 'i';
                    mensagem.value = mensagem.value + '</i>';
                }
            }

            function colocarUnderline(campo){
                valor = campo.value;
                mensagem = document.getElementById('message');
                if(valor == 'u'){
                    campo.value = valor + '*';
                    mensagem.value = mensagem.value + '<u>';
                }else if(valor == 'u*'){
                    campo.value = 'u';
                    mensagem.value = mensagem.value + '</u>';
                }
            }
        </script>
    </head>
    <body>
        <!--CABEÇALHO-->
        <div id="header">
            <div id="menu">
                <ul id="main">
                    <li><a href="/Esquina_da_TI/index.php"><img src="/Esquina_da_TI/images/home.png" class="menu"  title="Inicio" /><br/><b>Inicio</b></a></li>
                        <li><a href="/Esquina_da_TI/Gui/Forum.php"><img src="/Esquina_da_TI/images/forum.png" class="menu" title="Fórum"/><br/><b>Fórum</b></a></li>
                        <li><a href="javascript:exibirVerNoticia()"><img src="/Esquina_da_TI/images/noticia.png" class="menu" title="Noticia"/><br/><b>Notícias</b></a></li>
                        <li><a href="javascript:exibirVerArtigos()"><img src="/Esquina_da_TI/images/artigo.png" class="menu" title="Artigos"/><br/><b>Artigos</b></a></li>
                        <li><a href="/Esquina_da_TI/Gui/Downloads.php"><img src="/Esquina_da_TI/images/download.png" class="menu" title="Downloads"/><br/><b>Downloads</b></a></li>
                        <li><a href="/Esquina_da_TI/Gui/CadastroUsuario.php"><img src="/Esquina_da_TI/images/Cadastro.png" class="menu" title="Cadastro"/><br/><b>Cadastro</b></a></li>
                        <li><a href="/Esquina_da_TI/Gui/OportunidadeEmprego.php"><img src="/Esquina_da_TI/images/oportunidade.png" class="menu" title="Empregos"/><br/><b>Empregabilidade</b></a></li>
                        <li><a href="javascript:exibirFaleConosco()"><img src="/Esquina_da_TI/images/faleconosco.png" class="menu" title="Fale Conosco"/><br/><b>Fale Conosco</b></a></li>
                        <li><a href="javascript:favoritos()"><img src="/Esquina_da_TI/images/addFavoritos.png" class="menu" title="Add Favoritos"/><br/><b>Favoritos</b></a></li>
                </ul>
            </div>
            <div id="logo">
                <h1><a href="#"><span>Esquina da T.I.</span></a></h1>
                <p>a Tecnologia a seu alcance</p>
            </div>
        </div>
        <div id="wrapper">
            <div id="page">
                <br/>
                <a href='/Esquina_da_TI/Gui/Forum.php'><font style="text-align:left" size="5px" color="Red">Indice dos Foruns</font></a>
                <font style="text-align:left" size="5px" color="Green">>>></font>
                <a href='/Esquina_da_TI/Gui/exibirAssuntos.php?forum=<?php echo $forum;?>'><font style="text-align:left" size="5px" color="Red"><?php echo $forum;?></font></a>
                <font style="text-align:left" size="5px" color="Green">>>></font>
                <a href='/Esquina_da_TI/Gui/exibirTopicos.php?forum=<? echo $forum;php?>&assunto=<?php echo $assunto;?>'><font style="text-align:left" size="5px" color="Red"><?php echo $assunto;?></font></a>
                <font style="text-align:left" size="5px" color="Green">>>></font>
                <a href='/Esquina_da_TI/Gui/exibirTopico.php?forum=<? echo $forum;php?>&assunto=<?php echo $assunto;?>&topico=<?php echo $topico;?>'><font style="text-align:left" size="5px" color="Red"><?php echo $topico;?></font></a>

                <!--CONTEUDO DO CENTRO-->
                <div align="center" style="border:double">
                    <div class="post" align="center">
                        <form id="reponderTopico" name="reponderTopico" action="cadastrarResposta.php?forum=<? echo $forum;php?>&assunto=<?php echo $assunto;?>&topico=<?php echo $topico;?>" method="post">
                            <table class="forum" border="5" cellspacing="1" cellpadding="1">
                                <tr>
                                    <td width='15%' class="head" colspan="4"><b>Responder a "<?php echo $topico ?>"</b></td>
                                </tr>
                                <tr>
                                    <td class='responder' width="15%">Assunto</td>
                                    <td class='responder' width="85%">Re: <?php echo $topico?></td>
                                </tr>
                                <tr>
                                    <td class='forum' width="15%" rowspan="2">Corpo da mensagem<br/><br/>

                                        <table align="center">
                                            <tr>                                               
                                                <td align="center" colspan="4">
                                                    Emoticons
                                                </td>                                                
                                            </tr>
                                            <tr>
                                                <td>&nbsp;<a href="javascript:emoticon(':)');"><img src="/Esquina_da_TI/images/smilies/3b63d1616c5dfcf29f8a7a031aaa7cad.gif" border="0"></a>&nbsp;</td>
                                                <td>&nbsp;<a href="javascript:emoticon(':D');"><img src="/Esquina_da_TI/images/smilies/283a16da79f3aa23fe1025c96295f04f.gif" border="0"></a>&nbsp;</td>
                                                <td>&nbsp;<a href="javascript:emoticon(':(');"><img src="/Esquina_da_TI/images/smilies/9d71f0541cff0a302a0309c5079e8dee.gif" border="0"></a>&nbsp;</td>
                                                <td>&nbsp;<a href="javascript:emoticon(':-o');"><img src="/Esquina_da_TI/images/smilies/47941865eb7bbc2a777305b46cc059a2.gif" border="0"></a>&nbsp;</td>
                                            </tr>

                                            <tr>
                                                <td>&nbsp;<a href="javascript:emoticon(':shock:');"><img src="/Esquina_da_TI/images/smilies/385970365b8ed7503b4294502a458efa.gif" border="0"></a>&nbsp;</td>
                                                <td>&nbsp;<a href="javascript:emoticon(':?:');"><img src="/Esquina_da_TI/images/smilies/0a4d7238daa496a758252d0a2b1a1384.gif" border="0"></a>&nbsp;</td>
                                                <td>&nbsp;<a href="javascript:emoticon(':8)');"><img src="/Esquina_da_TI/images/smilies/b2eb59423fbf5fa39342041237025880.gif" border="0"></a>&nbsp;</td>
                                                <td>&nbsp;<a href="javascript:emoticon(':lol:');"><img src="/Esquina_da_TI/images/smilies/97ada74b88049a6d50a6ed40898a03d7.gif" border="0"></a>&nbsp;</td>
                                            </tr>

                                            <tr>
                                                <td>&nbsp;<a href="javascript:emoticon(':x');"><img src="/Esquina_da_TI/images/smilies/1069449046bcd664c21db15b1dfedaee.gif" border="0"></a>&nbsp;</td>
                                                <td>&nbsp;<a href="javascript:emoticon(':P');"><img src="/Esquina_da_TI/images/smilies/69934afc394145350659cd7add244ca9.gif" border="0"></a>&nbsp;</td>
                                                <td>&nbsp;<a href="javascript:emoticon(':oops:');"><img src="/Esquina_da_TI/images/smilies/499fd50bc713bfcdf2ab5a23c00c2d62.gif" border="0"></a>&nbsp;</td>
                                                <td>&nbsp;<a href="javascript:emoticon(':cry:');"><img src="/Esquina_da_TI/images/smilies/c30b4198e0907b23b8246bdd52aa1c3c.gif" border="0"></a>&nbsp;</td>
                                            </tr>

                                            <tr>
                                                <td>&nbsp;<a href="javascript:emoticon(':evil:');"><img src="/Esquina_da_TI/images/smilies/2e207fad049d4d292f60607f80f05768.gif" border="0"></a>&nbsp;</td>
                                                <td>&nbsp;<a href="javascript:emoticon(':twisted:');"><img src="/Esquina_da_TI/images/smilies/908627bbe5e9f6a080977db8c365caff.gif" border="0"></a>&nbsp;</td>
                                                <td>&nbsp;<a href="javascript:emoticon(':roll:');"><img src="/Esquina_da_TI/images/smilies/2786c5c8e1a8be796fb2f726cca5a0fe.gif" border="0"></a>&nbsp;</td>
                                                <td>&nbsp;<a href="javascript:emoticon(':wink:');"><img src="/Esquina_da_TI/images/smilies/8a80c6485cd926be453217d59a84a888.gif" border="0"></a>&nbsp;</td>
                                            </tr>

                                            <tr>
                                                <td>&nbsp;<a href="javascript:emoticon(':!:');"><img src="/Esquina_da_TI/images/smilies/9293feeb0183c67ea1ea8c52f0dbaf8c.gif" border="0"></a>&nbsp;</td>
                                                <td>&nbsp;<a href="javascript:emoticon(':?');"><img src="/Esquina_da_TI/images/smilies/136dd33cba83140c7ce38db096d05aed.gif" border="0"></a>&nbsp;</td>
                                                <td>&nbsp;<a href="javascript:emoticon(':idea:');"><img src="/Esquina_da_TI/images/smilies/8f7fb9dd46fb8ef86f81154a4feaada9.gif" border="0"></a>&nbsp;</td>
                                                <td>&nbsp;<a href="javascript:emoticon(':arrow:');"><img src="/Esquina_da_TI/images/smilies/d6741711aa045b812616853b5507fd2a.gif" border="0"></a>&nbsp;</td>
                                            </tr>                                            
                                        </table>

                                    </td>
                                    <td class='forum' width='80%'>
                                        <br/>
                                        &nbsp;<input id="negrito" name="negrito" type="button" value="B" class="negrito" onclick="javascript:colocarNegrito(this)"/>
                                        <input type="button" value="i" class="italico" onclick="javascript:colocarItalico(this)"/>
                                        <input type="button" value="u" class="underline" onclick="javascript:colocarUnderline(this)"/>&nbsp;&nbsp;&nbsp;

                                        <font size="2px">Cor do Texto:</font>
                                        <select onchange="javascript:fontColor('<font color=' + this.form.corFonte.options[this.form.corFonte.selectedIndex].value + '></font>')" name="corFonte">
                                            <option style="COLOR: black; BACKGROUND-COLOR: #fafafa" value="#444444" selected="selected">Padrao</option>
                                            <option style="COLOR: darkred; BACKGROUND-COLOR: #fafafa" value="darkred">Vermelho Escuro</option>
                                            <option style="COLOR: red; BACKGROUND-COLOR: #fafafa" value="red">Vermelho</option>
                                            <option style="COLOR: orange; BACKGROUND-COLOR: #fafafa" value="orange">Laranja</option>
                                            <option style="COLOR: brown; BACKGROUND-COLOR: #fafafa" value="brown">Marrom</option>
                                            <option style="COLOR: yellow; BACKGROUND-COLOR: #fafafa" value="yellow">Amarelo</option>
                                            <option style="COLOR: green; BACKGROUND-COLOR: #fafafa" value="green">Verde</option>
                                            <option style="COLOR: olive; BACKGROUND-COLOR: #fafafa" value="olive">Verde Oliva</option>
                                            <option style="COLOR: cyan; BACKGROUND-COLOR: #fafafa" value="cyan">Ciano</option>
                                            <option style="COLOR: blue; BACKGROUND-COLOR: #fafafa" value="blue">Azul</option>
                                            <option style="COLOR: darkblue; BACKGROUND-COLOR: #fafafa" value="darkblue">Azul Escuro</option>
                                            <option style="COLOR: violet; BACKGROUND-COLOR: #fafafa" value="violet">Violeta</option>
                                            <option style="COLOR: white; BACKGROUND-COLOR: #fafafa" value="white">Branco</option>

                                            <option class="genmed" style="COLOR: black; BACKGROUND-COLOR: #fafafa" value="black">Preto</option>
                                        </select>
                                        &nbsp;

                                        <!--
                                        <font size="2px">Fonte:</font>
                                        <select onchange="javascript:fontSize('<font size=' + this.form.tamanhoFonte.options[this.form.tamanhoFonte.selectedIndex].value + 'px></font>')" name="tamanhoFonte">
                                            <option value="7">Muito Pequena</option>
                                            <option value="9">Pequena</option>
                                            <option value="12" selected="selected">Normal</option>
                                            <option value="18">Grande</option>
                                            <option value="24">Gigante</option>

                                        </select>
                                        -->


                                        <br/><br/>

                                        <textarea id="message" tabindex="3" name="message" rows="15" cols="100"></textarea>
                                    </td>
                                </tr>
                                <tr>
                                    <td><input type="submit" value="Confirmar" /></td>
                                </tr>                                
                            </table>
                        </form>
                    </div>                    

                </div>
                <br/>
                <div align="center" style="border:double">
                    <div class="post" align="center">
                        <table class="forum" cellspacing="1" cellpadding="1">
                            <tr>
                                <td width='15%' class="head" colspan="6"><b>Revisar Mensagem</b></td>
                            </tr>
                            <tr>
                                <td>&nbsp;</td>
                            </tr>
                            <tr>
                                <td rowspan='3'>&nbsp;</td>
                                <td class='head' colspan="2" width="15%">Autor</td>
                                <td class='head' colspan="2" width="85%">Mensagem </td>
                                <td rowspan='3'>&nbsp;</td>
                            </tr>
                            <?php
                            require_once($_SERVER["DOCUMENT_ROOT"] . '/Esquina_da_TI/Gui/Fachada.php');
                            require_once($_SERVER["DOCUMENT_ROOT"] . '/Esquina_da_TI/ClassesBasicas/Topico.php');
                            $fachada = new Fachada();
                            $topicoAtual = new Topico();

                            $topicoAtual = $fachada->exibirTopico($topico);

                            $dataTopico = $topicoAtual->getData();
                            $tituloTopico = $topicoAtual->getTitulo();
                            $autorTopico = $topicoAtual->getUsuario();
                            $textoTopico = $topicoAtual->getTexto();

                            $usuario = new Usuario();
                            $usuario = $fachada->localizarUsuario($codigo, $nome, $autorTopico);
                            $fotoAutor = $usuario->getFoto();                            

                            echo "<tr>";
                            echo "<td class='responder' colspan='2'>". $dataTopico. "</td>";
                            echo "<td class='responder' colspan='2'>Titulo: <font color='blue'>". $tituloTopico. "</font></td>";
                            echo "</tr>";
                            echo "<tr>";
                            echo "<td class='forum' align='center' colspan='2'>". $autorTopico. "<br/><br/>";
                            echo "<img src='".$fotoAutor."' class='forum'/>";
                            echo "</td>";

                            $linhas = explode("\n", $textoTopico);
                            $tamanhoTexto = count($linhas);

                            $texto = str_replace("\n", "<br/>", $textoTopico);


                            echo "<td class='responderForum' height='$tamanhoTexto' colspan='2'>".$texto."</td>";
                            echo "</tr>";
                            ?>
                            <tr>
                                <td>&nbsp;</td>

                            </tr>
                        </table>
                    </div>
                    <a href="/Esquina_da_TI/index.php"><font color="blue"><<<&nbsp;Voltar</font></a>
                    <br><br>
                </div>

            </div>
            <!--BARRA DO RODAPÉ-->
            <div style="clear: both;">&nbsp;</div>
        </div>
    </div>
    <!--RODAPÉ-->
    <div id="footer">
        <p class="copyright">&copy;&nbsp;&nbsp;2009 All Rights Reserved &nbsp;&bull;&nbsp; Design by <a href="#">H1 Softwares</a>.</p>
        <p class="link"><a href="#">Privacy Policy</a>&nbsp;&#8226;&nbsp;<a href="#">Terms of Use</a></p>
    </div>
</body>
</html>

